<?php

    require_once('../include/connectBDD.php');
    require_once('../class/securite.class.php');
if($_GET['value'] == 0)
{
    $req = "SELECT COUNT(*) FROM favidee WHERE idIdee = '" . securite::bdd($_GET['ididee']) . "'";
    $req = mysql_query($req) or die(mysql_error());
    $data = mysql_result($req, 0);

    if ($data == 0) 
    {
        $req = "INSERT INTO favidee VALUES('" . securite::bdd($_GET['idu']) . "', '" . securite::bdd($_GET['ididee']) . "')";
        $req = mysql_query($req) or die(mysql_error());
        echo "true";
    } 
    else 
    {
        echo "false";
    }
}
elseif($_GET['value'] == 1)
{
    $query = "Delete FROM favidee where idU = '".securite::bdd($_GET['idu'])."'  AND idIdee = '".securite::bdd($_GET['ididee'])."' " ; 
    $res = mysql_query($query) ; 
}
?>